describe('practice-5-6', function () {

    it("找出3~1000以内的孪生素数", function () {
        var arr_twin_prime = get_twin_prime();
        console.info('arr_twin_prime:'+arr_twin_prime);
        expect(arr_twin_prime.length).toBe(35);
        for(var i = 0;i < arr_twin_prime.length;i ++)
        {
            expect(test_prime(arr_twin_prime[i].twin_smaller)).toBe(1);
            expect(test_prime(arr_twin_prime[i].twin_bigger)).toBe(1);
            expect(arr_twin_prime[i].twin_bigger-arr_twin_prime[i].twin_smaller).toBe(2);
        }
    });

});
function test_prime(n)
{
    var k = Math.sqrt(n)+1;
    for(var j = 2;j < k; j ++)
    {
        if(n%j === 0)
            return 0;
    }
    return 1;
}